<%-- 
    Document   : list_report
    Created on : Jun 18, 2013, 9:29:11 PM
    Author     : fikri
--%>

<%@ include file="/WEB-INF/jsp/include/page_header.jspf" %>
<%@ taglib prefix="display" uri="http://displaytag.sf.net"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>.: Observation : list report :.</title>
        <script type="text/javascript">
            $(function() {
                $("#datepicker2").datepicker({
                    showOn: "button",
                    buttonImage: "${pageContext.request.contextPath}/images/icon/calendar.gif",
                    buttonImageOnly: true,
                    changeMonth: true,
                    dateFormat: 'dd/mm/yy',
                    changeYear: true
                });
            });
            
            function popupWin(id, t) {
                var url = '';
                if (t === '1') url = '${pageContext.request.contextPath}/report?genReportByIText&id=' + id;
                else if (t === '2') url = '${pageContext.request.contextPath}/report?genReportActionPlanByIText&id=' + id;
                var left = (screen.width / 2) - (1000 / 2);
                var top = (screen.height / 2) - (1000 / 2);
                var params = 'width=1000';
                params += ', height=1000';
                params += ', top=' + top;
                params += ', left=' + left;
                //params += ', fullscreen=yes';
                params += ', directories=no';
                params += ', location=no';
                params += ', menubar=no';
                params += ', resizable=no';
                params += ', scrollbars=yes';
                params += ', status=no';
                params += ', toolbar=no';
                newwin = window.open(url, 'PopUp', params);
                if (window.focus) {
                    newwin.focus();
                }
                return false;
            }
        </script>
    </head>
    <body>
        <s:useActionBean beanclass="exatrez.stripes.util.ListUtil" var="list"/>
        <s:form beanclass="exatrez.stripes.action.ReportAction" name="form1">
            <div>

                <div id="page-title">
                    <span class="title">Searching</span>
                </div>   
                <p>
                    <label>Vessel</label>
                    <s:select name="observation.vessel.vesselId" style="width:150px">
                        <s:option value="">Please Choose</s:option>
                        <s:options-collection collection="${list.vesselList}" label="vesselName" value="vesselId"/>
                    </s:select>
                </p>
                <%--<p>
                    <label>Date Of Inspection</label>
                    <s:text name="observation.dateOfInspection" id="datepicker2" formatType="date" formatPattern="dd/MM/yyyy"
                            onblur="editDateBlur(this, 'DD/MM/YYYY')"
                            onkeypress="return editDatePre(this, 'DD/MM/YYYY', event)"
                            onkeyup="return editDate(this, 'DD/MM/YYYY', event);"/>  
                </p>--%>
                <p>
                    <label>&nbsp;</label>
                    <s:submit name="search" value="Search" class="btn"/>
                    <s:button name="clear" value="Clear" class="btn"/>
                </p>

            </div>

            <div>
                <display:table class="tablecloth" name="${actionBean.list}" 
                               requestURI="/report" id="line">
                    <display:column title="No.">${line_rowNum}</display:column>
                    <display:column title="Vessel" >${line.vessel.vesselName}</display:column>
                    <display:column title="Date Inspection"><fmt:formatDate value="${line.dateOfInspection}" pattern="dd/MM/yyyy"/></display:column>                    
                    <display:column title="Observation">${fn:length(line.taskList)}</display:column>
                    <display:column title="Location" property="location"/>
                    <display:column title="Report Observation" style="width:170px;">
                        <!--<a href="#" onclick="return popupWin('${line.observationId}','1');">Report Obs</a>-->
                        <s:submit name="" value="Generate PDF" onclick="return popupWin('${line.observationId}','1');" class="btn" />
                        <!--<a href="#" onclick="return popupWin('${line.observationId}','2');">Report Action Plan</a>-->
                    </display:column>
                    <display:column title="Report Action Plan" style="width:170px;">
                        <s:submit name="" value="Generate PDF" onclick="return popupWin('${line.observationId}','2');" class="btn" />
                    </display:column>
                </display:table>
            </div>

        </s:form>
    </body>
</html>
